package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;

import static com.sky.constant.OthersConstant.SHOP_STATUS;

@RestController("userShopController")
@Slf4j
@Api(tags = "设置营业状态接口")
@RequestMapping("/user/shop")
public class ShopController {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @GetMapping("/status")
    @ApiOperation(value = "查询营业状态")
    public Result<Integer> queryStatus(){
        return Result.success(Integer.parseInt(stringRedisTemplate.opsForValue().get(SHOP_STATUS)));
    }
}
